/**
 * @author scylla
 * @version V1.0
 * @Project echo-java-base
 * @Title 产生异常的线程
 * @Description *
 * @Package concurrent.mthread.exceptions
 * @Since 2021/8/3 11:13 上午
 */
package concurrent.mthread.exceptions;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ExceptionThread implements Runnable {

    public static void main(String[] args) {
        try {
            ExecutorService executors = Executors.newCachedThreadPool();
            executors.execute(new ExceptionThread());
        } catch (Exception e) {
            System.err.println("主动捕获异常将失效。。这里永远不会执行。" + e.getMessage());
        } finally {
            //try catch中 finally方法快将可以执行。
            System.out.println("最终代码执行");
        }

    }

    @Override
    public void run() {
        throw new RuntimeException("运行时主动抛出异常。");
    }
}
